﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Security.Cryptography;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.Text;
using System.Data;

/// <summary>
/// Summary description for ClassUser
/// </summary>
public class ClassUser
{
	public ClassUser()
	{
  
	}

   
    public void UpdateUser(string userName,string password,string fullName , string email , int roleId)
    {
        SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
        SqlCommand sqlCmd = new SqlCommand("UpdateUser", conn);
        sqlCmd.CommandType = CommandType.StoredProcedure;
        sqlCmd.Parameters.Add(new SqlParameter("@user", userName));
        sqlCmd.Parameters.Add(new SqlParameter("@pass", password));
        sqlCmd.Parameters.Add(new SqlParameter("@full", fullName));
        sqlCmd.Parameters.Add(new SqlParameter("@mail", email));
        sqlCmd.Parameters.Add(new SqlParameter("@role", roleId));
        conn.Open();
        sqlCmd.ExecuteNonQuery();
        conn.Close();
    }
    public void DeleterUser(string userName)
    {
        SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
        SqlCommand sqlCmd = new SqlCommand("DeleteUser", conn);
        sqlCmd.CommandType = CommandType.StoredProcedure;
        sqlCmd.Parameters.Add(new SqlParameter("@user", userName));
        conn.Open();
        sqlCmd.ExecuteNonQuery();
        conn.Close();
    }
}
